import React, { Component } from 'react'
import './App.css';
import { inject, observer } from 'mobx-react';
import { computed } from 'mobx';
@inject('counter')
@observer
class App extends Component {
  componentDidMount () {
    // const { getData } = this.props.counter;
    // getData()
  }
  render() {
    const { counter } = this.props;
    return (
      <div className="App">
        <button onClick={counter.increment}> + </button>
        <span>{counter.count}</span>
        <button onClick={counter.decrement}> - </button>
        <span>{counter.getResult}</span>
        <div>
          <input 
            type="text"
            value={counter.username}
            onChange={ 
              e => counter.changeUsername(e.target.value)
            } />
            {counter.username}
        </div>
        {/* <div>
          {counter.users.map((user, index) => (
            <div key={index}>
              <span>{user.login}</span>
              <span>{user.id}</span>
            </div>
          ))}
        </div> */}
      </div>
    );
  }
}

export default App;
